import Cookies from 'js-cookie'

const TokenKey = 'USER_TOKEN'

// 设置登录过期时间为 7 天
const sevenDaysLater = new Date()
sevenDaysLater.setDate(sevenDaysLater.getDate() + 7)

export function setToken(token) {
  return Cookies.set(TokenKey, token, { expires: sevenDaysLater })
}

export function getToken() {
  return Cookies.get(TokenKey)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}